<template>
  <view class="h-full" v-if="!isLogin">
    <PreAuth></PreAuth>
  </view>
  <view v-else>
    <u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
    <view v-if="current===0">
      <NativePay></NativePay>
    </view>
    <view v-else>
      <JSAPIPay></JSAPIPay>
    </view>
    {{ userInfo }}
  </view>
</template>

<script setup lang="ts">


import {useUserStore} from "@/store/user";
import {storeToRefs} from "pinia";
import PreAuth from "@/pages/pay/components/PreAuth.vue";
import {ref} from "vue";
import NativePay from "@/pages/pay/components/NativePay.vue";
import JSAPIPay from "@/pages/pay/components/JSAPIPay.vue";

const userStore = useUserStore()
const {isLogin, userInfo} = storeToRefs(userStore)


const list = ref(['Naive支付', 'JSAPI支付'])
const current = ref(0)
const sectionChange = (index: number) => {
  current.value = index
}

</script>

<style scoped>

</style>